﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace Aphysoft.Vate
{
    public static class EnumeratorHelper
    {
        /// <summary>
        /// Gets an item in the queue specified by index.
        /// </summary>
        /// <param name="queue">The queue.</param>
        /// <param name="index">Index of the item.</param>
        /// <returns></returns>
        public static T QueueGetItem<T>(Queue<T> queue, int index)
        {
            int i = 0;
            // iterate the queue.
            foreach (T entry in queue)
            {
                if (i == index)
                {
                    return entry;
                }
                i++;
            }
            return default(T);
        }
    }
}
